package com.sjl.springboot.domain;


import com.github.pagehelper.PageInfo;
import com.sjl.springboot.domain.enums.CommonCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.io.Serializable;

/**
 * 返回状态码和错误信息
 * @param <T>
 * @author sjl
 * @date 2018年12月28日 14:55:41
 */
@Getter
@Setter
@ToString
public class CommonResponse<T> implements Serializable {

    private static final long serialVersionUID = -3214885479484534221L;
    /**
     * 获取调用返回值
     */
    private T result;
    /**
     * 获取错误码
     */
    private String code = "TRADE_000";

    private String msg = "Success";
    /**
     * 分页信息
     */
    private PageInfo<T> pageInfo;




    public CommonResponse() {
    }

    public CommonResponse(CommonCode commonCode) {
        this.code = commonCode.getCode();
        this.msg = commonCode.getMsg();
    }

    public void setContent(CommonCode content) {
        this.code = content.getCode();
        this.msg = content.getMsg();

    }




}
